package com.aletto.general_store.presenters.core;

import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;

import com.sisyphus.spinach.core.INetTask;
import com.sisyphus.spinach.core.model.IResponse;
import com.sisyphus.spinach.network.presenters.NetSingleTask;

import io.reactivex.rxjava3.core.Observable;

public class NetResumeSingleTask<T, V extends INetTask.View<T>> extends NetSingleTask<T, V> {

    private boolean is_first_resume = true;

    public NetResumeSingleTask(Observable<? extends IResponse<T>> observable) {
        super(observable);
    }

    @Override
    public void onResume(@NonNull LifecycleOwner owner) {
        super.onResume(owner);

        if (is_first_resume){
            return;
        }

        execute();
        is_first_resume = false;

    }

}
